using System;
using System.Collections.Generic;
using System.Text;
using System.Data;

namespace InputProductForm
{
    class TType
    {
        UTLDB.UTLDB _cn = new UTLDB.UTLDB();
        public DataTable GetType()
        {
            DataTable data = new DataTable();
            data = _cn.GetDataByStoredProcedure("sp_SelectTypesAll");
            return data;
        }
        public DataTable GetTypeByActive(int active)
        {
            DataTable data = new DataTable();
            data = _cn.GetDataByStoredProcedure("sp_SelectTypesByActive",
                new string[] { "@Active" },
               new object[] { active });
            return data;
        }
        public int Insert(Info.InfoType info)
        {

            int id = _cn.ExecuteInsert("sp_InsertType",
               new string[] { "Sym","@Name", "@Active" },
               new object[] { info.Sym,info.Name, info.Active });
            return id;
        }
        public void Update(Info.InfoType info)
        {
            int id = _cn.ExecuteNonQuery("sp_UpdateType",
                  new string[] { "@ID","Sym", "@Name", "@Active" },
                  new object[] { info.Id,info.Sym, info.Name, info.Active });

        }

    }
}
